package com.itheima.myhashsettest;

import java.util.Comparator;
import java.util.TreeSet;

public class 随堂练习1 {
    public static void main(String[] args) {
        TreeSet<Integer> treeSet = new TreeSet<>(new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return o2 - o1;
            }
        });

        treeSet.add(20);
        treeSet.add(10);
        treeSet.add(30);
        treeSet.add(10);

        for (Integer i : treeSet) {
            System.out.println(i);
        }

    }
}
